package com.db.serialize.serializer;

import com.db.serialize.domain.SensorData;
import com.google.gson.Gson;

public class JsonSensorDataSerializer implements SensorDataSerializer {
    private Gson gson;

    public JsonSensorDataSerializer() {
        gson = new Gson();
    }

    @Override
    public Object serialize(SensorData sensorData) {
        return gson.toJson(sensorData);
    }

    @Override
    public SensorData deSerialize(Object data) {
        return gson.fromJson((String) data, SensorData.class);
    }
}
